package com.mvc.controller;

import com.mvc.pojo.User;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import javax.servlet.http.HttpSession;

@Controller
public class ModelTest1 {
    @RequestMapping("t1")
    public String test(HttpServletRequest request, HttpServletResponse response){
        HttpSession session = request.getSession();
        System.out.println(session.getId());

        return "hello";
    }
    @GetMapping("/t2")
    //转发
    public String test2(Model model){
        model.addAttribute("msg","ModelTest");
        return "foward:/WEB-INF/jsp/hello.jsp";
    }

    @GetMapping("/t3")
    public String test2(User user){
        System.out.println("user");
        return "hello";
    }



}
